<%= render :partial => "navigation" %>

<div id="containerBody">

  <% if @member.email == "" %>
		<div id="notices">
      <%= link_to "Please update your email address!",
          {:controller => "members", :action => "edit", :id => @member.id} %>
		</div>
  <% elsif @srcToggle and not @member.signed_src %>
		<div id="notices" class="noticeBox">
	    <%= link_to "Please sign the SRC!",
	        {:controller => "members", :action => "src"},
	        {:popup => ['new_window', 'height=600,width=800'] } %>
		</div>
  <% end %>

	<div class="container progressContainer">
		<div class="cellRow cellRowHeader">
			<div class="cellBlock" style="width: 50%">
				Announcements
			</div>
			<div class="cellBlock">
				Shout outs
			</div>
		</div>
		<div class="cellRow cellRow1">
			<div class="cellBlock" style="padding: 0">
				<div class="announcements">
					<div class="container" style="width: 100%; font-size: 1.2em">
						<%= render :partial => "announcement", :locals => {:announcements => @announcements} %>
					</div>
				</div>
			</div>
			<div class="cellBlock" style="padding: 0">
				<div class="announcements">
					<div class="container" style="width: 100%; font-size: 1.2em">
						<%= render :partial => "announcement", :locals => {:announcements => @shoutouts} %>
					</div>
				</div>
			</div>
		</div>
		<div class="cellRow">
			<div class="cellBlock">&nbsp;
				<% if session[:user].admin %>
					<% form_tag({:action => "post_admin", :member_id => session[:user]}, {:style => "display: inline"}) do -%>
						<%= text_field_tag "message", nil, :maxlength => 160, :style => "width: 20em" -%>
						<%= submit_tag "post", :disable_with => "wait..." -%>
					<% end -%>
				<% end %>
			</div>
			<div class="cellBlock">&nbsp;
				<% form_tag({:action => "post_member", :member_id => session[:user]}, {:style => "display: inline"}) do -%>
					<%= text_field_tag "message", nil, :maxlength => 160, :style => "width: 20em" -%>
					<%= submit_tag "shout!", :disable_with => "wait..." -%>
				<% end -%>
			</div>
		</div>
	</div>

  <!-- Birthdays here -->
	<div style="float: left; font-size: 1.5em; font-weight: bold; clear: left; margin: 0 0 0.5em 2.5em;">Birthdays</div>
	<div id="birthdayContainer" class="container containerBorder" style="margin-bottom: 1em">

		<% counter = 0 %>
		<% @birthdays.each do |member| %>
			<% if member.age.to_i > 10 %>
				<div class="cellRow cellRow<%= counter%2+1 %>">
					<div class="cellBlockNoBorder cellBlockNoBorderL">
						<%= link_to h(member.full_name), :controller => "members", :action => "show", :id => member %>
					</div>
					<div class="cellBlockNoBorder cellBlockNoBorderR">
						<% if(member.birthday.day == Date.today.day and member.birthday.mon == Date.today.mon) %>
							Today
						<% else %>
							<%=h member.birthday.strftime("%m/%d/%y") %>
						<% end %>
					</div>
					<div class="cellBlockNoBorder cellBlockNoBorderR"><%=h member.age %></div>
				</div>
				<% counter = counter + 1 %>
			<% end %>
		<% end %>
		<% if counter == 0 %>
			<div class="cellRow cellRow1">
				<div class="cellBlock cellBlockNoBorder">
					None! =(
				</div>
			</div>
		<% end %>

	</div>
	<!-- google calendar gadget.  too lazy to play around with this at the moment.
	<div style="clear: left; float: left; margin-left: -0.5em;">
        <script src="http://www.gmodules.com/ig/ifr?url=http://www.google.com/ig/modules/calendar-for-your-site.xml&amp;up_showCalendar2=1&amp;up_showAgenda=1&amp;up_calendarFeeds=(%7B%7D)&amp;up_firstDay=Sunday&amp;up_syndicatable=true&amp;up_stylesheet=&amp;up_sub=1&amp;up_c0u=http%3A%2F%2Fwww.google.com%2Fcalendar%2Ffeeds%2F8bev6a45snflo154gii06ddp08%2540group.calendar.google.com%2Fpublic%2Fbasic&amp;up_c0c=&amp;up_c1u=&amp;up_c1c=&amp;up_c2u=&amp;up_c2c=&amp;up_c3u=&amp;up_c3c=&amp;up_min=&amp;up_start=&amp;up_timeFormat=1%3A00pm&amp;up_calendarFeedsImported=0&amp;synd=open&amp;w=220&amp;h=300&amp;title=&amp;border=%23ffffff%7C3px%2C1px+solid+%23999999&amp;output=js"></script>
	</div>
	-->

  <!-- Potential Progress -->
	<div style="float: right; width: 19em; font-size: 1.5em; font-weight: bold; margin: 0.5em 0">Potential Progress</div>
	<div class="container progressContainer">

		<div class="cellRow cellRowHeader">
			<div class="cellBlock">Service Points</div>
			<div class="cellBlock">Leadership Points</div>
			<div class="cellBlock">Fellowship Points</div>
			<div class="cellBlock">Meeting Points</div>
			<div class="cellBlock">Fundraising Points</div>
			<div class="cellBlock">Dues</div>
<!--			 if @member.status == "Pledge"
				<div class="cellBlock">Pledge Reqs</div>
			 end  -->
		</div>

		<div class="cellRow cellRow1">
		<% if (@member.status == "Active" or @member.status == "New Active" or @member.status == "Associate" or @member.status == "Probate")%>
			<div class="cellBlock"><%=h @memberData["service"]["potential"] %>/<%= @memberData["total_required_hours"] %></div>
			<div class="cellBlock"><%=h @memberData["leadership"]["potential"].to_i %>/<%= Member.active_leaderships_requirement %></div>
			<div class="cellBlock"><%=h @memberData["fellowship"]["potential"].to_i %>/<%= Member.active_fellowships_requirement %></div>
			<div class="cellBlock"><%=h @memberData["meeting"]["potential"].to_i %>/<%= Member.active_meetings_requirement %></div>
			<div class="cellBlock"><%=h @memberData["fundraiser"]["potential"].to_i %>/<%= Member.active_fundraisers_requirement %></div>
			<div class="cellBlock"><%=h @memberData["dues"].to_i %>/<%= Member.active_dues_requirement %></div>

		<% elsif(@member.status == "Pledge" or @member.status == "Neophyte") %>
			<div class="cellBlock"><%=h @memberData["service"]["potential"] %>/<%= @memberData["total_required_hours"] %></div>
			<div class="cellBlock"><%=h @memberData["leadership"]["potential"].to_i %>/<%= Member.pledge_leaderships_requirement %></div>
			<div class="cellBlock"><%=h @memberData["fellowship"]["potential"].to_i %>/<%= Member.pledge_fellowships_requirement %></div>
			<div class="cellBlock"><%=h @memberData["meeting"]["potential"].to_i %>/<%= Member.pledge_meetings_requirement %></div>
			<div class="cellBlock"><%=h @memberData["fundraiser"]["potential"].to_i %>/<%= Member.pledge_fundraisers_requirement %></div>
			<div class="cellBlock"><%=h @memberData["dues"].to_i %>/<%= Member.pledge_dues_requirement %></div>
<!--			<div class="cellBlock">%=h @memberData[20] %>/%= Member.pledge_reqs_requirement %</div>-->

		<% else %>
			<div class="cellBlock">&nbsp;</div>
			<div class="cellBlock">&nbsp;</div>
			<div class="cellBlock">&nbsp;</div>
			<div class="cellBlock">&nbsp;</div>
			<div class="cellBlock">&nbsp;</div>
			<div class="cellBlock">&nbsp;</div>
		<% end %>
		</div>

	</div>

	<!--  Actual Progress	-->

	<div class="progressTitle">Actual Progress</div>

	<div class="container progressContainer">

		<div class="cellRow cellRowHeader">
			<div class="cellBlock">Service Hours</div>
			<div class="cellBlock">Leadership Points</div>
			<div class="cellBlock">Fellowship Points</div>
			<div class="cellBlock">Meeting Points</div>
			<div class="cellBlock">Fundraising Points</div>
			<div class="cellBlock">Dues</div>
<!--			% if @member.status == "Pledge" %
				<div class="cellBlock">Pledge Reqs</div>
			% end %-->
		</div>

		<div class="cellRow cellRow1">
		<% if (@member.status == "Active" or @member.status == "New Active" or @member.status == "Associate" or @member.status == "Probate")%>
			<div class="cellBlock"><%=h @memberData["service"]["actual"] %>/<%= @memberData["total_required_hours"] %></div>
			<div class="cellBlock"><%=h @memberData["leadership"]["actual"].to_i %>/<%= Member.active_leaderships_requirement %></div>
			<div class="cellBlock"><%=h @memberData["fellowship"]["actual"].to_i %>/<%= Member.active_fellowships_requirement %></div>
			<div class="cellBlock"><%=h @memberData["meeting"]["actual"].to_i %>/<%= Member.active_meetings_requirement %></div>
			<div class="cellBlock"><%=h @memberData["fundraiser"]["actual"].to_i %>/<%= Member.active_fundraisers_requirement %></div>
			<div class="cellBlock"><%=h @memberData["dues"].to_i %>/<%= Member.active_dues_requirement %></div>

		<% elsif(@member.status == "Pledge" or @member.status == "Neophyte") %>
			<div class="cellBlock"><%=h @memberData["service"]["actual"] %>/<%= @memberData["total_required_hours"] %></div>
			<div class="cellBlock"><%=h @memberData["leadership"]["actual"].to_i %>/<%= Member.pledge_leaderships_requirement %></div>
			<div class="cellBlock"><%=h @memberData["fellowship"]["actual"].to_i %>/<%= Member.pledge_fellowships_requirement %></div>
			<div class="cellBlock"><%=h @memberData["meeting"]["actual"].to_i %>/<%= Member.pledge_meetings_requirement %></div>
			<div class="cellBlock"><%=h @memberData["fundraiser"]["actual"].to_i %>/<%= Member.pledge_fundraisers_requirement %></div>
			<div class="cellBlock"><%=h @memberData["dues"].to_i %>/<%= Member.pledge_dues_requirement %></div>
<!--			<div class="cellBlock">%=h @memberData[21] %/%= Member.pledge_reqs_requirement %</div>-->

		<% else %>
			<div class="cellBlock">&nbsp;</div>
			<div class="cellBlock">&nbsp;</div>
			<div class="cellBlock">&nbsp;</div>
			<div class="cellBlock">&nbsp;</div>
			<div class="cellBlock">&nbsp;</div>
			<div class="cellBlock">&nbsp;</div>
		<% end %>
		</div>
	</div>

	<div class="progressTitle">Your Upcoming Events</div>

	<div class="container progressContainer containerBorder" style="width: 30em; margin-right: 7em;">

		<% counter = 0 %>

		<% @events.each do |event| %>

			<% if @member.attendance_records.find_by_event_id(event.id).waitlist == 0 %>
				<div class="cellRow cellRow<%= counter % 2 == 0?1:2 %>">

				<% if event.date.future? and !event.deleted %>

					<div class="cellBlockNoBorder cellBlockNoBorderL">
						<%= link_to h(event.name), :controller=> "events", :action => "show" , :id => event %>
					</div>
					<div class="cellBlockNoBorder cellBlockNoBorderR">
						<% if event.date.today? %>
							Today at <%=h event.date.strftime("%I:%M %p")%>
						<% else %>
							<%=h event.date.strftime("%A, %b %d at %I:%M %p") %>
						<% end %>
					</div>

	    			<% counter = counter + 1 %>

				<% end %>

				</div>
			<% end %>

		<% end %>

		<% if counter == 0 %>
		    <div class="cellRow cellRow1">
		        <div class="cellBlock" style="border-right: none">None =(</div>
		    </div>
		<% end %>

	</div>

</div>
